<script>

function deepCopy(obj) {
	if(!obj) return;
	if(obj instanceof RegExp) return new RegExp(obj);
	if(obj instanceof Date) return new Date(obj);
	if(typeof(obj) !== 'object') return obj;

	let res = {};
	for(let key in obj) {
		if(!obj.hasOwnProperty(key)) continue;
		res[key] = deepCopy(obj[key]);
	}
	
	return res;
}

let obj = {
	a: 1,
	b: {
		a: {
			a: 1,
		},
	},
	c: /^\d{11}$/,
	d: new Date(),
	e: function(){console.log('a')}
}

let res = deepCopy(obj);
console.log(res);
</script>